﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
using System.Data;

namespace CarService
{
    public partial class Front : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Load_Data();
            if (!Page.IsPostBack)
            {
                Load_Service();
            }
        }

        private void Load_Data()
        {
            SettingInfo settingInfo = SettingData.SelectBySiteID(Config.Global.Settings.SiteID);

            lblAddress.Text = settingInfo.SiteAddress;
            lblPhone.Text = settingInfo.SitePhone;
            lblSiteName.Text = settingInfo.SiteName;
            lblYear.Text = settingInfo.SiteYear;
            lblSiteURL.Text = "<a href=\"http://www." + settingInfo.SiteURL + "\">" + settingInfo.SiteURL + "</a>";
        }

        private void Load_Service()
        {
            DataTable dtbService = ServiceData.SelectAllBySiteID(Config.Global.Settings.SiteID);

            if ((dtbService != null) && (dtbService.Rows.Count > 0))
            {
                rptService.DataSource = dtbService;
                rptService.DataBind();
            }
        }
    }
}